package com.cti.commons.delayqueue.listener;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Component;

import com.cti.commons.delayqueue.handler.DelayQueueHandler;
import com.xxl.job.core.handler.annotation.XxlJob;

/**
 * @author et.wang
 * @description: 根据topic消费(消费者)
 * @date 2022/11/17 14:35
 */
@Component
public class DelayCustomerLoader {

    @Autowired
    private DelayQueueHandler delayQueueHandler;

    @Resource(name = "customerPoolTaskExecutor")
    private ThreadPoolTaskExecutor customerPoolTaskExecutor;

    @XxlJob("delayQueueHandler")
    public void run() {
        customerPoolTaskExecutor.execute(() -> {
            delayQueueHandler.execute();
        });
    }

}
